#include <iostream>
#include <vector>
using namespace std;

using real_t = double;

void bcDif4(const real_t *u, int ofst, bool is_left, real_t dif[3]) {
  ofst = is_left ? ofst : -ofst;
  const double coef = is_left ? 1.0 / 12.0 : -1.0 / 12.0;
  dif[0] = coef * (u[-2 * ofst] - 8 * u[-ofst] + 8 * u[ofst] - u[2 * ofst]);
  dif[1] = coef * (-3 * u[-2 * ofst] - 10 * u[-ofst] + 18 * u[0] - 6 * u[ofst] +
                   u[2 * ofst]);
  dif[2] = coef * (-25 * u[-2 * ofst] + 48 * u[-ofst] - 36 * u[0] +
                   16 * u[ofst] - 3 * u[2 * ofst]);
}

struct Func {
  real_t operator()(real_t x) const {
    return (((2.0 * x + 3.0) * x + 0.5) * x + 4.0) * x + 1.5;
  }
  real_t dif(real_t x) const { return 4.0 + x + 9.0 * x * x + 8.0 * x * x * x; }
};

int main() {
  const int size = 20;
  const real_t dx = 1.0;
  vector<real_t> val(size), posx(size), difx(size);
  Func fx;
  for (int i = 0; i < size; ++i) {
    posx[i] = i * dx;
    val[i] = fx(posx[i]);
    difx[i] = fx.dif(posx[i]);
  }

  // 左端
  real_t df[3];
  bcDif4(&val[2], 1, true, df);
  for (int i = 0; i < 3; ++i)
    cout << df[i] - difx[2 - i] << endl;

  // 右端
  bcDif4(&val[size - 3], 1, false, df);
  for (int i = 0; i < 3; ++i)
    cout << df[i] - difx[size - (3 - i)] << endl;

  return 0;
}